<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\business\EhrHelper;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $searchModel common\models\kingdee\PersonSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = Yii::t('kingdee', 'People');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="person-index">

    <h1><?= Html::encode($this->title) ?></h1>
    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <p>
        <?= Html::a(Yii::t('kingdee', 'Create Person'), ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <?= GridView::widget([
        'tableOptions' => ['class' => 'table table-condensed table-bordered table-striped table-hover'],
        'pager' => [
//            'class'          => GoPager::className(),
            'nextPageLabel'  => Yii::t('app', 'Next Page'),
            'prevPageLabel'  => Yii::t('app', 'Previous Page'),
            'firstPageLabel' => Yii::t('app', 'First Page'),
            'lastPageLabel'  => Yii::t('app', 'Last Page'),
            'options' => [
                'class' => 'pagination pagination-sm m-t-none m-b-none',
            ],
        ],
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            [
                'class' => 'yii\grid\SerialColumn',
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 25px;'],
            ],

//            'FID',
//            'FIDNUM',
//            'FNAME_L1',
//            'FNAME_L2',
            [
                'label' => Yii::t('app', 'Employee Name'),
                'attribute' => 'FNAME_L2',
                'contentOptions' => ['style' => 'width: 100px;'],
            ],
//            'FNAME_L3',
            // 'FNUMBER',
            [
                'label' => Yii::t('app', 'Employee Number'),
                'attribute' => 'FNUMBER',
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
            ],
            // 'FDESCRIPTION_L1',
            // 'FDESCRIPTION_L2',
            // 'FDESCRIPTION_L3',
            // 'FSIMPLENAME',
            [
                'label' => Yii::t('app', 'Gender'),
                'attribute' => 'FGENDER',
                'value' => function ($model, $key, $index, $column) {
                    return EhrHelper::getGenderByIntValue($model['FGENDER']);
                },
                'filter' => EhrHelper::getGender_map(),
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 80px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 80px;'],
            ],
//            'FBIRTHDAY',
            [
                'label' => Yii::t('app', 'Birthday'),
                'attribute' => 'FBIRTHDAY',
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 80px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
            ],
//            'FEMAIL:email',
            [
                'label' => Yii::t('app', 'Email'),
                'attribute' => 'FEMAIL',
                'format' => 'email',
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
                'contentOptions' => ['style' => 'width: 150px;'],
            ],
            // 'FADDRESS_L1',
//            'FADDRESS_L2',
//            [
//                'label' => Yii::t('app', 'Address'),
//                'attribute' => 'FADDRESS_L2',
//                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
//                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 150px;'],
//            ],
            // 'FADDRESS_L3',
            // 'FSTATE',
            // 'FHOMEPHONE',
            // 'FOFFICEPHONE',
//            'FCELL',
            [
                'label' => Yii::t('app', 'Mobile'),
                'attribute' => 'FCELL',
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
            ],
            // 'FBACKUPCELL',
            // 'FBACKUPEMAIL:email',
            // 'FRTX',
            // 'FIDCARDNO',
            [
                'label' => Yii::t('app', 'Id Card No'),
                'attribute' => 'FIDCARDNO',
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
            ],
            // 'FIDCARDADRESS_L1',
            // 'FIDCARDADRESS_L2',
            // 'FIDCARDADRESS_L3',
            // 'FPASSPORTNO',
            // 'FOLDNAME_L1',
            // 'FOLDNAME_L2',
            // 'FOLDNAME_L3',
            // 'FHEIGHT',
            // 'FNATIVEPLACE_L1',
            // 'FNATIVEPLACE_L2',
            [
                'label' => Yii::t('app', 'Native Place'),
                'attribute' => 'FNATIVEPLACE_L2',
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
            ],
            // 'FNATIVEPLACE_L3',
            // 'FBLOODTYPE',
            [
                'attribute' => 'FBLOODTYPE',
                'label' => Yii::t('app', 'Blood Type'),
                'value' => function ($model) {
                    return EhrHelper::getBloodTypeByIntValue($model['FBLOODTYPE']);
                },
                'filter' => EhrHelper::getBloodType_map(),
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
            ],
            // 'FCREATORID',
            // 'FCREATETIME',
            // 'FLASTUPDATEUSERID',
            // 'FLASTUPDATETIME',
            // 'FKACLASSFICATIONID',
//            'FWEDID',
            [
                'attribute' => 'FWEDID',
                 'label' => Yii::t('app', 'Wed Status'),
                'value' => function ($model) {
                    return EhrHelper::getWedStrById($model['FWEDID']);
                },
                'filter' => ArrayHelper::map(\common\models\kingdee\HrWed::find()->all(), 'FID', 'FNAME_L2'),
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
            ],
//             'FHEALTHID',
//            [
//                'attribute' => 'FHEALTHID',
//                'label' => Yii::t('app', 'Health Condition'),
//                'value' => function ($model) {
//                    return EhrHelper::getHealthStrById($model['FHEALTHID']);
//                },
//                'filter' => ArrayHelper::map(\common\models\kingdee\HrHealth::find()->all(), 'FID', 'FNAME_L2'),
//                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
//                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
//            ],
            // 'FPOLITICALFACEID',
            // 'FSTANDINGID',
//             'FFOLKID',
            [
                'attribute' => 'FFOLKID',
                'label' => Yii::t('app', 'Folk'),
                'value' => function ($model) {
                    return EhrHelper::getFolkStrById($model['FFOLKID']);
                },
                'filter' => ArrayHelper::map(\common\models\kingdee\HrFolk::find()->all(), 'FID', 'FNAME_L2'),
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
            ],
            // 'FBIRTHID',
            // 'FCONTROLUNITID',
            // 'FHRORGUNITID',
            // 'FRESIDENCEPLACE',
            // 'FLENOFACTUALSERVICE',
            // 'FEMPLOYEETYPEID',
            // 'FHIGHESTTECHPOSTID',
            // 'FHIGHESTDEGREEID',
            // 'FEMPLOYEECLASSIFYID',
            // 'FDELETEDSTATUS',
            // 'FLCMRATIONLEVELID',
//             'FNATIONALITYID',
            [
                'attribute' => 'FNATIONALITYID',
                'label' => Yii::t('app', 'Nationality'),
                'value' => function ($model) {
                    return EhrHelper::getNationalityStrById($model['FNATIONALITYID']);
                },
                'filter' => ArrayHelper::map(\common\models\kingdee\Nationality::find()->all(), 'FID', 'FNAME_L2'),
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
            ],
            // 'FCHECKSTATE',
            // 'FINDEX',
            // 'FEMPLOYTECHPOSTID',
            // 'FHIGHESTSUBDEGREEID',
            // 'FZDY1',
            // 'FZDY2',
            // 'FZDY3',
            // 'FZDY4',
            // 'FZDY5',
            // 'FZDY6',
            // 'FZDY7',
            // 'FZDY8',
            // 'FZDY9',
            // 'FZDY10',
            // 'FZDY11',
            // 'FZDY12',
            // 'FZDY13',
            // 'FZDY14',
            // 'FZDY15',
            // 'FZDY16',
            // 'FZDY17',
            // 'FZDY18',
            // 'FZDY19',
            // 'FZDY20',
            // 'FZDY21',
            // 'FZDY22',
            // 'FZDY23',
            // 'FZDY24',
            // 'FZDY25',
            // 'FZDY26',
            // 'FFULLNAMEPINGYIN',
            // 'FSIMPLENAMEPINGYIN',
            // 'FISSTANDBY',
            // 'FISSTANDBYCADRE',
            // 'FHIGHESTCOMPETENCYID',
            // 'FNAMEPINYIN',
            // 'FNAMESHORTPINYIN',
//             'FREGRESIDENCEID',
            [
                'attribute' => 'FREGRESIDENCEID',
                'label' => Yii::t('app', 'Regpermresidence'),
                'value' => function ($model) {
                    return EhrHelper::getRegpermresidenceStrById($model['FREGRESIDENCEID']);
                },
                'filter' => ArrayHelper::map(\common\models\kingdee\Regpermresidence::find()->all(), 'FID', 'FNAME_L2'),
                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 100px;'],
            ],
            // 'FHJADDRESS',
            // 'FIDCARDADDRESS',
//            [
//                'label' => Yii::t('app', 'Id Card Address'),
//                'attribute' => 'FIDCARDADDRESS',
//                'headerOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
//                'contentOptions' => ['class' => 'vertical-middle text-center', 'style' => 'width: 120px;'],
//            ],
            // 'FHOMEPLACE',
            // 'FEFFDT',
            // 'FLEFFDT',
            // 'FHISTORYRELATEID',
            // 'FIDCARDBEGINDATE',
            // 'FIDCARDENDDATE',
            // 'FEXTENDFIELDNUMONE',
            // 'FPROTOCOL',
            // 'FIDCARDISSUEORG',
            // 'CFTC',
            // 'CFTSRYBSID',
            // 'CFFXDW',
            // 'CFGATXZ',
            // 'CFPTTXZ',
            // 'CFISJZZ',
            // 'CFJHSYQKID',
            // 'CFZVCSNY',
            // 'CFISGG',
            // 'CFISQB',
            // 'CFSBGXDW',
            // 'CFYHKXX',
            // 'CFISXSCT',
            // 'CFRDYZNX',
            // 'CFSXRQ',
            // 'CFJFSXRQ',
            // 'CFJFNX',
            // 'CFJFJZRQ',
            // 'CFGZD',
            // 'CFRDTSJ',

            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]); ?>
</div>
